// Getparam.js
(function($) {
	$.extend({
		//1、取值使用    $.Request("name")
		Request: function(name) {
			var sValue = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]*)(\&?)", "i"));
			//decodeURIComponent解码
			return sValue ? decodeURIComponent(sValue[1]) : decodeURIComponent(sValue);

		},
		//2、给url加参数    $.UrlUpdateParams(url, "add", 11111);
		UrlUpdateParams: function(url, name, value) {
			var r = url;
			if (r != null && r != 'undefined' && r != "") {
				value = encodeURIComponent(value);
				var reg = new RegExp("(^|)" + name + "=([^&]*)(|$)");
				var tmp = name + "=" + value;
				if (url.match(reg) != null) {
					r = url.replace(eval(reg), tmp);
				} else {
					if (url.match("[\?]")) {
						r = url + "&" + tmp;
					} else {
						r = url + "?" + tmp;
					}
				}
			}
			return r;
		},
		//3、封装warning    $.Jwarning("msg")
		Jwarning: function(msg) {
			let html =
				'<div class="tipWarn"><div class="weui-toptips weui-toptips_warn" id="tipWarn" style="opacity: 1;display: block;position: initial;width: 100%;border-radius:6px;">' +
				msg + '</div></div>';
			$('#containerVue').append(html)
			setTimeout(function() {
				$(".tipWarn").remove();
			}, 3000)
		},
		//4、封装success    $.Jsuccess("msg")
		Jsuccess: function(msg) {
			let html =
				'<div id="toast" style="opacity: 1; display: block;"><div class="weui-mask_transparent"></div><div class="weui-toast" style="padding: 0 15px;"><i class="weui-icon-success-no-circle weui-icon_toast"></i><p class="weui-toast__content">' +
				msg + '</p></div>';
			$('#containerVue').append(html)
			setTimeout(function() {
				$("#toast").remove();
			}, 3000)
		}
	});
})(jQuery);
function closeView() {
	window.history.go(-1);
}